<?php
/**
 * Created by PhpStorm.
 * User: gm
 * Date: 2018/12/11
 * Time: 10:43
 */
include "config.php";
include "status.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    if(isset($_REQUEST["uemail"])&&isset($_REQUEST["uname"])&&isset($_REQUEST["upwd"])){
        $UEMAIL=$_REQUEST["uemail"];
        $UNAME=$_REQUEST["uname"];
        $UPWD=$_REQUEST["upwd"];

        $sql="INSERT INTO userinfo (u_email,u_name,u_pwd) VALUES (?,?,?);";
        $stmt=$conn->prepare($sql);
        $stmt->bind_param("sss",$UEMAIL,$UNAME,$UPWD);
        $stmt->execute();
        if($stmt->affected_rows>=1){
            print_r(json_encode(Status::$r_s));
        }else{
            print_r(json_encode(Status::$r_f));
        }
        $stmt->close();
        $conn->close();
    }else{
        print_r(json_encode(Status::$no_key));
    }
}else{
    print_r(json_encode(Status::$no_get));
}